# This file is part of BlackArch Linux ( http://blackarch.org ).
# See COPYING for license details.

pkgname=hiddeneye
pkgver=1228.7a3deaf
pkgrel=8
pkgdesc='Modern phishing tool with advanced functionality.'
arch=('any')
groups=('blackarch' 'blackarch-social')
url='https://github.com/DarkSecDevelopers/HiddenEye'
license=('MIT')
depends=('python' 'python-requests' 'python-pyngrok' 'python-future'
         'python-yaml' 'php' 'python-pgrep')
makedepends=('git')
replaces=('hidden-eye')
source=("$pkgname::git+https://github.com/DarkSecDevelopers/HiddenEye.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's|open("LICENSE"|open("/usr/share/licenses/hiddeneye/LICENSE"|g' \
    controllers/EULA_controller.py
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" *.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm *.md requirements.txt LICENSE

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python HiddenEye.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

